import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    sentimentData: {
      total: 172180,
      positive: 40744,
      negative: 10688,
      neutral: 64650
    },
    regions: [
      { name: '蜀山区', value: 120 },
      { name: '庐阳区', value: 100 },
      { name: '包河区', value: 80 },
      { name: '瑶海区', value: 70 },
      { name: '经开区', value: 60 }
    ]
  },
  mutations: {
    updateSentimentData(state, data) {
      state.sentimentData = data
    },
    updateRegions(state, data) {
      state.regions = data
    }
  },
  actions: {
    async fetchSentimentData({ commit }) {
      // 这里添加实际的API调用
      // const response = await axios.get('/api/sentiment-data')
      // commit('updateSentimentData', response.data)
    },
    async fetchRegionsData({ commit }) {
      // 这里添加实际的API调用
      // const response = await axios.get('/api/regions-data')
      // commit('updateRegions', response.data)
    }
  }
}) 